package com.itheima.mp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.mp.domain.po.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {
    void UpadteBalancebyBatchIds(@Param("ew") LambdaQueryWrapper<User> wrapper, @Param("amount") int amount);

    /**
     * 根据id扣减余额
     * @param id
     * @param money
     */
    @Update("update mp_user set balance=balance-#{money} where id=#{id}")
    void deductMoneyById(@Param("id") Long id, @Param("money") Integer money);
}
